# coding=utf-8

from Products.Archetypes.atapi import *
from Products.ATContentTypes.content import schemata

from cintra.types.config import PROJECTNAME
from cintra.types.content import cintrauser
from cintra.policy.utils.utils import set_schemata_properties, finalizeSchema

from zope.i18nmessageid import MessageFactory, Message

_ = MessageFactory("cintra")

#===============================================================================
# Definição dos schemas do tipo Cintra
#===============================================================================

MAIN = Schema((
        StringField('firstName',
			required=1,
            widget=StringWidget(label=_('First Name'),
            ),
        ),


        StringField('lastName',
            required=1,
            widget=StringWidget(label=_('Last Name'),
            ),
        ),    

        StringField('middleInitial',
            widget=StringWidget(label=_('Middle Initial'),
                                                visible={'edit': 'invisible', 'view': 'invisible',},
            ),      
        ),
        
        StringField('email',
           required=1, 
           validators='isEmail',
           widget=StringWidget(label=_('Email'),
           ),
        ),
))


SIGN_PASSWORD = Schema((
    StringField('signPassword',
                        encryption='SSHA',
                        widget=PasswordWidget(label=_('Sign Password'),
                                                    visible={'edit': 'invisible',
                                                             'view': 'invisible',
                                                             }
                                                    ),
                        ),
))

set_schemata_properties(MAIN, schemata='Principal')
set_schemata_properties(SIGN_PASSWORD, schemata='Assinatura Eletronica')

#baseSchema = finalizeSchema(cintrauser.CINTRAUserSchema.copy())

DesenvolvimentoSchema = MAIN + SIGN_PASSWORD + cintrauser.CINTRAUserSchema.copy()
#AdministrativoSchema = MAIN + SIGN_PASSWORD + cintrauser.CINTRAUserSchema.copy()
 
#set_schemata_properties(AdministrativoSchema, read_permission=VIEW_DOCTOR, write_permission=EDIT_DOCTOR) 
